package com.zwj.mapper;

import com.zwj.bo.SelectHomeworkInfoBo;
import com.zwj.bo.SelectUnApprovedBo;
import com.zwj.bo.WorkApproval;
import com.zwj.dto.AddHomeworkDto;
import com.zwj.dto.AddHomeworkSubmitDto;
import com.zwj.entity.WorkInfoEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zwj.vo.SelectHomeworkInfoVo;
import com.zwj.vo.SelectHomeworkStudentVo;
import com.zwj.vo.SelectHomeworkVo;
import com.zwj.vo.SelectUnApprovedVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 作业信息表 Mapper 接口
 * </p>
 *
 * @author zwj
 * @since 2021-07-21
 */

@Mapper
public interface WorkInfoMapper extends BaseMapper<WorkInfoEntity> {
    int addHomework(AddHomeworkDto addHomeworkDto);
    int addHomeworkSubmit(AddHomeworkSubmitDto addHomeworkSubmitDto);

    String selectStudentIsLeader(String teamInfoId);

    String selectAllStudent(String teamInfoId);

    Integer selectFinalWork(Long courseProjectInfoId);

    int selectSumByState(@Param("workId") Long workId,@Param("workStatus") String workStatus);

    List<SelectHomeworkInfoVo> selectHomeworkInfo(SelectHomeworkInfoBo selectHomeworkInfoBo);

    SelectHomeworkVo selectHomeWorkById(Long workId);

    List<SelectUnApprovedVo> selectUnApprovedHomework(SelectUnApprovedBo selectUnApprovedBo);
    List<SelectUnApprovedVo> selectApprovedHomework(SelectUnApprovedBo selectUnApprovedBo);

    @Update({"update work_info set del_flag = '1' where id = #{workId}"})
    int deleteHomework(@Param("workId") Long workId);

    @Update({"update work_submit_info set del_flag = '1' where id = #{workId}"})
    int deleteHomeworkSubmit(@Param("workId") Long workId);

    SelectHomeworkStudentVo selectHomeworkStudent(Long submitId);

    Integer submitWorkApproval(WorkApproval workApproval);

    Integer saveWorkApproval(WorkApproval workApproval);
}
